package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.ClassBean;
import com.project.dao.ClassDao;
import com.project.service.ClassService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 小班管理
 */

@Service
@Transactional
public class ClassServiceImpl extends ServiceImpl<ClassDao, ClassBean> implements ClassService {

    /**
     * 分页显示所有小班信息
     * @param pageNo
     * @param pageSize
     * @return
     */
    @Override
    public IPage<ClassBean> findAllClass(int pageNo, int pageSize) {
        Page<ClassBean> page = new Page<>(pageNo,pageSize);
        return this.baseMapper.findAllClass(page);
    }


    /**
     * 添加小班
     * @param classBean
     */
    @Override
    public void addClass(ClassBean classBean) {
        this.baseMapper.addClass(classBean);
    }

    /**
     * 根据小班id查询详细信息
     * @param classId
     * @return
     */
    @Override
    public ClassBean findId(int classId) {
        return this.baseMapper.findId(classId);
    }


    /**
     * 根据小班id修改小班负责人、负责人电话
     * @param classId
     * @param classMan
     * @param classManTel
     */
    @Override
    public String updateClass(int classId, String classMan, String classManTel) {
        return this.baseMapper.updateClas(classId,classMan,classManTel);
    }

    /**
     * 根据小班名称、负责区域模糊查询小班信息
     * @param className
     * @param area
     * @return
     */
    @Override
    public IPage<ClassBean> findName(int pageNo, int pageSize,String className, String area) {
        Page<ClassBean> page = new Page<>(pageNo,pageSize);
        return this.baseMapper.findName(page,className,area);
    }
}
